package com.pro.controller;

import com.pro.entry.JsCarousel;
import com.pro.service.JsCarouselService;
import com.pro.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author 谭金诚
 * @Description TODO
 * @Date 2022/4/14 11:05
 * @Version 1.0
 */
@Controller
@RequestMapping("/jsCarousels")
public class JsCarouselController {

    @Autowired
    private JsCarouselService service;

    @GetMapping("/getJsCarousels")
    @ResponseBody
    public JsonData getJsCarousels(){
        List<JsCarousel> jsCarousels = service.getJsCarousels();
        return jsCarousels != null ? JsonData.buildSuccess(jsCarousels) : JsonData.buildSuccess("服务端错误");
    }
}
